package com.malty.common.domain;

import com.malty.common.ErrorCode;
import lombok.Data;

/**
 * @author malty
 */
@Data
public class Result<T> {
    private int code;
    private String message;
    private T result;

    public Result(int code, T data, String message) {
        this.code = code;
        this.result = data;
        this.message = message;
    }

    public Result(int code, T data) {
        this(code, data, "");
    }

    public Result(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
}
